package tom.shared;

import java.io.Serializable;
import java.util.List;

public class Product implements Serializable {

	private static final long serialVersionUID = -8863272226421923439L;

	public Product() {
	}

	public String proCode;
	public String name;
	public String descript;
	public String proGrp;
	public String unit;
	public Double discount = 6.542;
	public Double sellPrice = 100000.0;
	public Double purPrice = 0.0;
	public Double minPrice = 0.0; // คำนวณตอนคีย์บิลซื้อ จากราคา LastPurchase Price
	
	public String purVAT = "1";
	public String sellVAT = "1";
	public String supplier;
	public String incomeAcc = "4101.001";
	public String costAcc = "5101.001";
	public Boolean stockItem = true;
	public Boolean sellItem = true;
	public Boolean buyItem = true;
	public Boolean active = true;
	public String creUser;
	public String creTime;
	public List<Stock> stocks;
	public Double dc1 = 0.0;
	public Double dc2 = 0.0;
	public Double dc3 = 0.0;
	public Double dc4 = 0.0;
	public Double dc5 = 0.0;
	public String stkCode = "";
	public String barcode;

	@Override
	public String toString() {
		return proCode + name + descript + proGrp + unit + discount + sellPrice
				+ purPrice + minPrice + purVAT + sellVAT + supplier + incomeAcc
				+ costAcc + stockItem + sellItem + buyItem + active + creUser
				+ creTime + dc1 + dc2 + dc3 + dc4 + dc5;
	}

	public int getBalance() {
		int bal = 0;
		for (Stock s : stocks) {
			bal += s.balance;
		}
		return bal;
	}

}
